From: Matthew Daley Date: Tue, 10 Sep 2013 15:16:02 +0000 (+0200) Subject: sched/arinc653: check for guest data transfer failures X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6381 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=546ba2f17008387cf9821df46e6dac04f0883a9b;p=xen.git sched/arinc653: check for guest data transfer failures Coverity-ID: 1055121 Coverity-ID: 1055122 Coverity-ID: 1055123 Coverity-ID: 1055124 Signed-off-by: Matthew Daley Reviewed-by: Andrew Cooper Acked-by: George Dunlap Acked-by: Keir Fraser --- diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c index 63ddb82bc6..2502192226 100644 --- a/xen/common/sched_arinc653.c +++ b/xen/common/sched_arinc653.c @@ -635,12 +635,21 @@ a653sched_adjust_global(const struct scheduler *ops, switch ( sc->cmd ) { case XEN_SYSCTL_SCHEDOP_putinfo: - copy_from_guest(&local_sched, sc->u.sched_arinc653.schedule, 1); + if ( copy_from_guest(&local_sched, sc->u.sched_arinc653.schedule, 1) ) + { + rc = -EFAULT; + break; + } + rc = arinc653_sched_set(ops, &local_sched); break; case XEN_SYSCTL_SCHEDOP_getinfo: rc = arinc653_sched_get(ops, &local_sched); - copy_to_guest(sc->u.sched_arinc653.schedule, &local_sched, 1); + if ( rc ) + break; + + if ( copy_to_guest(sc->u.sched_arinc653.schedule, &local_sched, 1) ) + rc = -EFAULT; break; }